using System;
using Toast.ContentTypes;
using Toast.Extensions;

namespace Toast.ContentDeliveryNetworks
{
    public class GoogleAjaxLibraries : IContentDeliveryNetwork
    {
        const string _libraryUrlPattern= "http://ajax.googleapis.com/ajax/libs/{0}/{1}/{0}.js"; 

        public static RemoteJavaScriptFile Get(string libraryName, string version)
        {
            var url = _libraryUrlPattern.FormatWith(new[] { libraryName, version });
            return RemoteJavaScriptFile.FromUrl(new Uri(url));
        }
    }
}